<?php
/**
 * The main template file
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * For example, it puts together the home page when no home.php file exists.
 *
 * @link http://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Twenty_Twelve
 * @since Twenty Twelve 1.0
 */

get_header(); get_template_part('block', 'home');?>

<section class="box-courses">
    <div class="fix">
        <div class="title"><?php echo TITLE_TRAINING_COURSE;?></div>
        <article class="introduce">
            <?php echo block_introduce;?>
        </article>

        <div class="data animated-area">
            <?php
            $args = array(
                'numberposts' => 4,
                'post_type' => 'page',
                'meta_key' => 'training',
                'meta_value' => '1'
            );
            $the_query = new WP_Query( $args );
            $i = 1;
            $s = 0.6;
            ?>
            <?php if( $the_query->have_posts() ): ?>
                    <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
                    <article data-animation="rotate-left" data-animation-delay="<?=$s?>s" data-animation-duration="0.8s" class="item item-<?=$i?> animated">
                        <img src="<?php echo wp_get_attachment_url( get_post_thumbnail_id(get_the_ID()) );?>" width="235" height="225" alt="<?php the_title(); ?>"/>
                        <h4><span class="text"><?php echo TITLE_INTENDED;?></span><span class="object"><?php the_title(); ?></span></h4>
                        <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php echo TITLE_LEARN_MORE;?></a>
                    </article>
                    <?php $i++; $s = $s+0.2; endwhile; ?>
            <?php endif; ?>
        </div>
    </div>
</section><!--//box-courses-->
    <?php get_template_part('block', 'faculty-hot'); /*danh sach giang vien noi bat*/?>
    <section class="box-mix animated-area">
        <div class="fix">
            <?php get_template_part('block', 'testimonial'); /*danh sach y kien noi bat*/?>
            <div class="news-us">
                <div class="title">
                    <span><?php echo TITLE_NEW_NEW;?></span>
                    <a href="" title=""><?php echo TITLE_VIEW_MORE;?> »</a>
                </div>
                <ul class="news-list">
                    <?php
                    $args = array('orderby'=> 'post_date','order'=> 'DESC','posts_per_page' => 4, 'post_status' => 'publish', 'suppress_filters'=>0,'post_type'=> 'post', 'meta_key'=>'is_new_index', 'meta_value'=>1);
                    $posts_new = get_posts( $args );
                    $ss = 0.6;
                    foreach($posts_new as $p_n2):
                    ?>
                    <li class="animated" data-animation="fade-in-up" data-animation-delay="<?php echo $ss;?>s">
                        <a href="<?php echo get_permalink($p_n2->ID);?>" title=""><?php echo $p_n2->post_title;?></a>
                    </li>
                    <?php $ss+=0.3; endforeach;?>
                </ul>
            </div><!--//news-us-->
        </div>
    </section><!--//box-mix-->
<?php get_template_part('block', 'customer-hot'); /*danh sach khách hàng nổi bật*/?>
<?php get_footer(); ?>